package com.egglazy.Utils;

public class ResultUtil {


    public static <T> Result<T> success(T data){
        Result<T> result = new Result<>();
        result.setCode(ReturnCode.SUCCESS.getCode());
        result.setMsg(ReturnCode.SUCCESS.getMsg());
        result.setData(data);
        return result;
    }

    public static <T> Result<T> success(String msg) {
        Result<T> result = new Result<>();
        result.setCode(ReturnCode.SUCCESS.getCode());
        result.setMsg(msg);
        return result;
    }

    public static <T> Result<T> fail(String msg) {
        Result<T> result = new Result<>();
        result.setCode(ReturnCode.FAIL.getCode());
        result.setMsg(msg);
        return result;
    }

    public static <T> Result<T> error(String msg) {
        Result<T> result = new Result<>();
        result.setCode(ReturnCode.ERROR.getCode());
        result.setMsg(msg);
        return result;
    }
}
